package com.yexiao.cofe.business.controller;

import com.yexiao.cofe.business.service.SmsService;
import com.yexiao.core.response.ResponseData;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 控制短信验证码
 */
@RestController
@RequestMapping("/sms")
public class SmsController {

    @Resource
    private SmsService smsService;

    @GetMapping("/getCode")
    public ResponseData getCode(@RequestParam String phone) {
        return ResponseData.success(smsService.getCode(phone));
    }

    @GetMapping("/changeSize")
    public ResponseData changeSmsSize(@RequestParam int size) {
        smsService.changeSmsSize(size);
        return ResponseData.success();
    }
}
